package com.fgxia.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fgxia.admin.service.IAdminSettleAccountsService;
import com.ruoyi.business.domain.bo.admin.AdminCompanySettleAccountsQueryBo;
import com.ruoyi.business.domain.bo.admin.AdminDriverSettleAccountsQueryBo;
import com.ruoyi.business.domain.vo.admin.AdminCompanySettleAccountsVo;
import com.ruoyi.business.domain.vo.admin.AdminDriverSettleAccountsVo;
import com.ruoyi.business.mapper.FreightInfoMapper;
import com.ruoyi.business.mapper.OrderInfoMapper;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 管理员结算账单服务实现
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class AdminSettleAccountsServiceImpl implements IAdminSettleAccountsService {
    private final OrderInfoMapper orderInfoMapper;

    private final FreightInfoMapper freightInfoMapper;

    /**
     * 获取客户结算列表
     *
     * @param queryBo
     * @return
     */
    @Override
    public TableDataInfo<AdminCompanySettleAccountsVo> listCompanySettleAccounts(AdminCompanySettleAccountsQueryBo queryBo, PageQuery pageQuery) {
        IPage<AdminCompanySettleAccountsVo> result = orderInfoMapper.selectCompanySettleAccountsList(pageQuery.build(), queryBo);

        return TableDataInfo.build(result);
    }

    /**
     * @param queryBo
     * @param pageQuery
     * @return
     */
    @Override
    public TableDataInfo<AdminDriverSettleAccountsVo> listDriverSettleAccounts(AdminDriverSettleAccountsQueryBo queryBo, PageQuery pageQuery) {
        IPage<AdminDriverSettleAccountsVo> result = freightInfoMapper.selectDriverSettleAccountsList(pageQuery.build(), queryBo);

        return TableDataInfo.build(result);
    }
}
